package com.bai.myss.mapper;

import com.bai.myss.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {
    @Select("select id, name, age from users")
    List<User> getAllUsers();

    @Select("select id, name, age from users where id = #{id}")
    User getUserById(int id);

    @Insert("inset into users(name, age) values (#{name}, #{age})")
    void insertUser(User user);

    @Update("update users set name = #{name},age = #{age} where id = #{id}")
    void updateUser(User user);

    @Delete("delete from users where id = #{id}")
    void deleteUser(Integer id);

}
